[MSBuild] How to overwrite ItemGroup (like what we do with PropertyGroup)

Posted by Nam Gi VU on Stack Overflow See other posts from Stack Overflow or by Nam Gi VU
Published on 2010-03-17T11:14:33Z Indexed on 2010/03/17 11:21 UTC
Read the original article Hit count: 132

Filed under:

I have a script snippet looks like below:

<ItemGroup>
  <files Include="*.txt"></files>
</ItemGroup>
<Message Text="@(files)">

<ItemGroup>
  <files Include="*.xml"></files>
</ItemGroup>
<Message Text="@(files)">

I want that in the second Message output, only *.xml is printed. Currently both of *.txt and *.xml are printed which is what I don't want to.

So, my question is how can we overwrite the item files in the second print script? Please help!

© Stack Overflow or respective owner

Related posts about msbuild